package com.shop.shoppingmall.service.impl;

import com.shop.shoppingmall.dao.ShCustomerServiceDao;
import com.shop.shoppingmall.entity.ShCustomerService;
import com.shop.shoppingmall.service.ShCustomerServiceService;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import javax.annotation.Resource;

/**
 * (ShCustomerService)表服务实现类
 *
 * @author makejava
 * @since 2020-09-29 10:21:18
 */
@Service("shCustomerServiceService")
@Transactional
public class ShCustomerServiceServiceImpl implements ShCustomerServiceService {
    @Resource
    private ShCustomerServiceDao shCustomerServiceDao;

    /**
     * 通过ID查询单条数据
     *
     * @param id 主键
     * @return 实例对象
     */
    @Override
    public ShCustomerService queryById(Integer id) {
        return this.shCustomerServiceDao.queryById(id);
    }

    /**
     * 新增数据
     *
     * @param shCustomerService 实例对象
     * @return 实例对象
     */
    @Override
    public ShCustomerService insert(ShCustomerService shCustomerService) {
        this.shCustomerServiceDao.insert(shCustomerService);
        return shCustomerService;
    }

    /**
     * 修改数据
     *
     * @param shCustomerService 实例对象
     * @return 实例对象
     */
    @Override
    public ShCustomerService update(ShCustomerService shCustomerService) {
        this.shCustomerServiceDao.update(shCustomerService);
        return this.queryById(shCustomerService.getId());
    }

    /**
     * 通过主键删除数据
     *
     * @param id 主键
     * @return 是否成功
     */
    @Override
    public boolean deleteById(Integer id) {
        return this.shCustomerServiceDao.deleteById(id) > 0;
    }
}